package model;

import util.IniParameters;
import controls.Refreshable;

public class TaskElement implements Refreshable {
	private int sourceLevel;
	private int destLevel;
	private int timeUnit; // time for walking to elevator
	private double currentWaitingTime;

	public TaskElement(int source, int dest) {
		sourceLevel = source;
		destLevel = dest;
		this.timeUnit = IniParameters.numberOfWaitingStates;
	}

	public int getSource() {
		return sourceLevel;
	}

	public int getDest() {
		return destLevel;
	}

	public int getTimeUnit() {
		return timeUnit;
	}

	public void setCurrentWaitingTime() {
		currentWaitingTime = 1.0;
	}

	// return waiting time in seconds for enhanced algorithm
	public double getCurrentWaitingTime() {
		return currentWaitingTime;
	}

	@Override
	public void refresh() {
		if (timeUnit >= 1) {
			timeUnit -= 1;
		} else if (timeUnit <= 0) {
			setCurrentWaitingTime();
		}
	}
}
